package com.cwj.blog.module.add

import com.cwj.blog.base.BaseObserver
import com.cwj.blog.base.BasePresenter
import com.cwj.blog.bean.SuccessBean

/**
 * created by cwj on 2024-1-10
 * Description:
 */
class AddBlogPrensenter(baseView: AddBlogView?) : BasePresenter<AddBlogView?>(baseView) {
    fun addBlog(map: MutableMap<String, Any>) {
        addDisposable(apiServer.addBlog(map), object : BaseObserver<SuccessBean?>() {
            override fun onSuccess(o: SuccessBean?) {
                if (o!!.code == 200) {
                    baseView!!.addBlogSuccess(o)
                } else {
                    baseView!!.error(o.msg)
                }
            }

            override fun onError(msg: String) {
                baseView!!.error(msg)
            }
        })
    }
}